package at.fhj.itm11.forum.gui;

import static org.junit.Assert.assertTrue;

import org.junit.Before;
import org.junit.Test;

import at.fhj.itm11.forum.api.ApiLookupNames;
import at.fhj.itm11.forum.gui.pages.ShowPostPage;
import at.fhj.itm11.forum.service.TestHelperService;

public class US10 extends AbstractGUITest {
	
	private TestHelperService dbHelper;

	@Before
	public void additionalSetUp() {
		dbHelper = lookupBean(ApiLookupNames.TEST_HELPER,
				TestHelperService.class);

		dbHelper.cleanDB();
		dbHelper.createDemoData();
	}

	
	@Test
	public void testCommentPost() throws InterruptedException {
		login();
		ShowPostPage showPostPage = navigateToShowPostPage(1);
		showPostPage.commentLink.click();
		showPostPage.commentField.sendKeys("test comment");
		showPostPage.commentButton.click();
		Thread.sleep(1000);
		
		assertTrue(showPostPage.commentToFirstPost.getText().contains("test comment"));
		
	}

}
